package impl

import (
	"adam2/internal/dto"
	"adam2/internal/vo"
	pConstants "anubis-framework/pkg/constants"
	pDomain "anubis-framework/pkg/domain"
	"time"
)

type ModelTopConceptBoardIndexDetailServiceImpl struct {
	*BaseServiceImpl
}

// 获取service的实现类
func GetModelTopConceptBoardIndexDetailServiceImpl() *ModelTopConceptBoardIndexDetailServiceImpl {
	return &ModelTopConceptBoardIndexDetailServiceImpl{GetBaseServiceImpl()}
}

// 分页显示
func (_modelTopConceptBoardIndexDetailServiceImpl ModelTopConceptBoardIndexDetailServiceImpl) Page(orderByColumnArray []vo.OrderByColumn, transactionDate time.Time, pageNo int, pageSize int) *pDomain.ServiceResult {
	var modelTopConceptBoardIndexDetailDtoArray dto.ModelTopConceptBoardIndexDetailDtoArray = _modelTopConceptBoardIndexDetailServiceImpl._modelTopConceptBoardIndexDetailDaoImpl.Page(orderByColumnArray, transactionDate, pageNo, pageSize)
	var total int = _modelTopConceptBoardIndexDetailServiceImpl._modelTopConceptBoardIndexDetailDaoImpl.PageTotal(transactionDate)
	var pageCount int
	if total%pageSize == 0 {
		pageCount = total / pageSize
	} else {
		pageCount = total/pageSize + 1
	}
	var pageDto dto.PageDto = dto.PageDto{modelTopConceptBoardIndexDetailDtoArray, total, pageCount}
	var serviceResult *pDomain.ServiceResult = &pDomain.ServiceResult{}
	serviceResult.Code = pConstants.OPERATION_SUCCESS_CODE
	serviceResult.Message = pConstants.OPERATION_SUCCESS_MESSAGE
	serviceResult.Success = true
	serviceResult.Result = pageDto
	return serviceResult
}
